# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>

pkgname=py3-migen
_pkgname=migen
pkgver=0.9.2
pkgrel=0
pkgdesc="Python-based tool that aims at automating further the VLSI design process"
url="https://m-labs.hk/gateware/migen/"
license="BSD-2-Clause"
arch="noarch"
depends="python3"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	py3-installer
	"
checkdepends="
	py3-pytest
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/m-labs/migen/archive/refs/tags/$pkgver.tar.gz

	d404437655107e99ee93101622cadf08fa103be1.patch
	"
builddir="$srcdir"/$_pkgname-$pkgver
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 -m installer dist/*.whl
	testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/*.whl
}

sha512sums="
9ff39f9f9b7e99b7d933e39091eb7e98c413ec3e60b98722d813df30fe95484470a1a027ac08bdf065bf688f4bb53af2c4618d3bbc0f1086adab33e149dca98f  py3-migen-0.9.2.tar.gz
a905c4fe7ca40f268fd23ec913cae17925aeed94d286093acad2c3e9bcb248824310a6846caed157548adbb0628a072c1cf5e9911bb4ed2001b53e50b93c279c  d404437655107e99ee93101622cadf08fa103be1.patch
"
